<template>
 <div id="app">
     <h3>用户登录</h3>
     <form>
         用户名：<input type="text" v-model="this.username"><br>
         密码：<input type="password" v-model="this.password"><br>
         <input type="button" value="登录" @click="login">

     </form>
 </div>
</template>

<script>
export default {
    name: "LoginView",
    data(){
        return{
            username: '',
            password: ''
        }
    },
    methods:{
        login() {
          if (this.username =='admin' && this.password =='admin'){
              this.$store.commit('changeLogin',true)
              this.$route.push("/routerlndex");
          }else {
              alert("用户名密码错误")
          }
       }
    }
}
</script>

<!--scopend 只对当前生效-->
<style scoped>

</style>